﻿<UserControl x:Class="VNet.VisiSuite.Controls.ProductionMeterGraphControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             SizeChanged="onSizeChanged"
             x:Name="ProductionMeterGraph"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Canvas x:Name="_canvas" Grid.Row="0">
        </Canvas>
        <ItemsControl x:Name="_legend" Grid.Row="1" HorizontalAlignment="Center" Margin="0,8,12,0" DataContext="{Binding ElementName=ProductionMeterGraph}" ItemsSource="{Binding Legend}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Background="{Binding Path=Color}" FontSize="{Binding FontSize, ElementName=ProductionMeterGraph}" Width="22" Margin ="12,0,0,0"/>
                        <TextBlock Text="{Binding Path=Description}" FontSize="{Binding FontSize, ElementName=ProductionMeterGraph}" Margin ="4,0,0,0"/>
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
